<?php

    date_default_timezone_set('Europe/Berlin');
    $wi = file("../twitter.txt");
    $wi_trim = array();
    for ($i = 0; $i < 10; $i++) {
        $wi_trim[$i] = str_replace(";", "", $wi[$i]);
    }
    
    $ausgabe = $wi_trim[0] . 'Uhr ' . utf8_encode($wi_trim[1]) .  '<br />'
             . 'Temp.: ' . $wi_trim[2] . '°C Luftdruck: ' . $wi_trim[5] . ' hPa ' . $wi_trim[6] . '<br />'
             . 'Wind: ' . $wi_trim[7] . ' km/h aus ' .$wi_trim[8] . '<br />'
             . 'Luftfeuchte: ' . $wi_trim[9] .'% <br />'
             . 'http://wetter-steinborn.de/images/minidisplay.gif';
    

    $xml = new DOMDocument('1.0','UTF-8');
    $xml->formatOutput = true;
    
    $roo = $xml->createElement('rss');
    $roo->setAttribute('version', '2.0');
    $xml->appendChild($roo);
    
    #create Channel Element
    $cha = $xml->createElement('channel');
    $roo->appendChild($cha);
    
    $cha->appendChild($xml->createElement('title', 'Wetter Steinborn'));
    $cha->appendChild($xml->createElement('description', 'Aktuelle Wetterinfos über Steinborn'));
    $cha->appendChild($xml->createElement('language', 'de'));
    $cha->appendChild($xml->createElement('link', 'http://wetter-steinborn.de/images/minidisplay.gif'));
    $cha->appendChild($xml->createElement('lastBuildDate', date("D, j M Y H:i:s")));
    
    #create the item element in the channel element
    $itm = $xml->createElement('item');
    $cha->appendChild($itm);
    
    $itm->appendChild($xml->createElement('title', 'Aktuelle Meldung'));
    $itm->appendChild($xml->createElement('description', $ausgabe));
    $itm->appendChild($xml->createElement('pubDate', date("D, j M Y H:i:s")));
    $itm->appendChild($xml->createElement('link', 'http://wetter-steinborn.de/images/minidisplay.gif'));
    
    $xml->save('wetter_info.xml');
    
    echo '<a href="wetter_info.xml">Zur XML</a>';
    
?>
